On the Performance of Parametric Polymorphism in Maple

نویسندگان

  • Laurentiu Dragan
  • Stephen M. Watt
چکیده

Data Type – Each value is some data object – Operations are implemented separately in a generic module – Same module shared by all the values belonging to each type Object-Oriented Approach DoubleRing := proc(val::float) local Me; Me := module() export v, a, s, m, d, gt, zero, one, coerce, absolute, sine, sqroot; v := val; # Data value of object # Implementations for +, -, *, /, >, etc a := (b) -> DoubleRing(Me:-v + b:-v); s := (b) -> DoubleRing(Me:-v – b:-v); m := (b) -> DoubleRing(Me:-v * b:-v); d := (b) -> DoubleRing(Me:-v / b:-v); gt := (b) -> Me:-v > b:-v; zero := () -> DoubleRing(0.0); coerce := () -> Me:-v; . . . end module: return Me; end proc: Object-Oriented Approach Previous example simulates object-oriented approach by storing the value in the module The exports a, s, m, d correspond to basic arithmetic operations We chose names other than the standard +, -, ×, / for two reasons: – The code looks similar to the original SciGMark (Java does not have operator overloading) – It is not very easy to overload operators in Maple Functions like sine and sqroot are used by the FFT algorithm to replace complex operations Abstract Data Type ApproachData Type Approach DoubleRing := module() export a, s, m, d, gt, zero, one, coerce, absolute, sine, sqroot; # Implementations for +, -, *, /, >, etc a := (a, b) -> a + b; s := (a, b) -> a – b; m := (a, b) -> a * b; d := (a, b) -> a / b; gt := (a, b) -> a > b; zero := () -> 0.0; one := () -> 1.0; coerce := (a::float) -> a; absolute := (a) -> abs(a); sine := (a) -> sin(a); sqroot := (a) -> sqrt(a); end module: Abstract Data Type ApproachData Type Approach Module does not store data, provides only the operations As a convention one must coerce the float type to the representation used by this module In this case the representation is exactly float DoubleRing module created only once for each kernel

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Parametric Polymorphism for Computer Algebra Software Components

This paper presents our experiments in providing mechanisms for parametric polymorphism for computer algebra software components. Specific interfaces between Aldor and C++ and between Aldor and Maple are described. We then present a general solution, Generic IDL (GIDL), an extension to CORBA IDL supporting generic types. We describe our language bindings for C++, Java 1.5 and Aldor as well as a...

متن کامل

Parametric Polymorphism Optimization for Deeply Nested Types in Computer Algebra

Computer algebra systems, such as Axiom, and programming languages designed for computer algebra, such as Aldor, have very flexible mechanisms for generic code, with type parameterization. Modern versions of Maple can support this style of programming through the use of Maple's module system, and by using module-producing functions to give parametric type constructors. From the software design ...

متن کامل

On the Classification of Parametric Cubic Curves

We consider the question of characterizing the behavior of parametric curves whose components are cubic polynomials. When there is no chance of confusion, we will refer to such curves as cubic curves with the understanding that each of x(t) and y(t) are themselves cubic polynomials. We classify various types of parametric cubics using their defining coefficients. We show that this can be done i...

متن کامل

Selective Screening of Phenylketonuria, Tyrosinemia and Maple Syrup Urine Disease in Southern Iran

Inborn errors of amino-acids metabolism and other inherited Mendeliandisorders are common in the MiddleEast.The number of diagnosed inborn errors of amino acid metabolism is growing constantly on account of and availability and improved of analytical techniques.  The aim of this work was to determine a rough estimate of the incidence rates of phenylketonuria (PKU), tyrosinemia, and maple syrup ...

متن کامل

انتخاب بافت گیاهی مناسب و شرایط بهینه نگهداری آن جهت مطالعات آنزیمی روی پایه‌های پلت (Acer velutinum Boiss.)

Acer velutinum Boiss. is considered as one of the most important of forest tree. Due to the abundant polymorphism and high sensitivity to environmental conditions, using the Peroxidase to study the genetic diversity is very common. The current study aimed to assess the qualitative and quantitative changes of peroxidase in different maintenance conditions of plant samples and also in different v...

متن کامل

On the non-parametric multivariate control charts in fuzzy environment

Multivariate control chats are generally used in situations where the simultaneous monitoring or control of two or more related quality characteristics is necessary. In most processes in the real world, distribution of the process characteristics are unknown or at least non-normal, so the non-parametric or distribution-free charts are desirable. Most non-parametric statistical process-control t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006